package com.hckjsec.cloud.domain;

import com.hckjsec.common.utils.ComUtil;
import com.hckjsec.common.utils.TencentCloudViewo;

import java.util.Random;

//视频实体类
public class WxVideoCallView {
    private String sdkAppID;
    private String secretKey;
    private String userId;//用户id
    private String userName;//用户姓名
    private String roomId;//房间号
    private String customroomid;//自定义房间号
    private String userSig;//加密
    private Long businessId;//业务id
    private Long videoId;//视频入库id
    private Long sid;//用户唯一编号

    public WxVideoCallView() {
    }

    public WxVideoCallView(String sdkAppID, String secretKey, String userId, String userName) {
        this.userSig= TencentCloudViewo.getUserSig(sdkAppID, secretKey, userName);
        this.roomId= getRoomRandomId();
        this.customroomid=ComUtil.getRandom(6);
        this.sdkAppID = sdkAppID;
        this.secretKey = secretKey;
        this.userId = userId;
        this.userName = userName;
    }

    public WxVideoCallView(String sdkAppID, String secretKey, String userId, String userName, String roomId, String customroomid) {
        this.userSig= TencentCloudViewo.getUserSig(sdkAppID, secretKey, userName);
        this.sdkAppID = sdkAppID;
        this.secretKey = secretKey;
        this.userId = userId;
        this.userName = userName;
        this.roomId = roomId;
        this.customroomid = customroomid;
    }

    private String getRoomRandomId(){
        String roomId;
        int maxId = 429496729;
        Random random = new Random();
        int roomBaseId  = random.nextInt(maxId);
        if(maxId == roomBaseId) {
            roomId = roomBaseId + String.valueOf(random.nextInt(5));
        }else {
            roomId = roomBaseId + String.valueOf(random.nextInt(9));
        }
        return roomId;
    }






    public String getSdkAppID() {
        return sdkAppID;
    }

    public void setSdkAppID(String sdkAppID) {
        this.sdkAppID = sdkAppID;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRoomId() {
        return roomId;
    }

    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }

    public String getUserSig() {
        return userSig;
    }

    public void setUserSig(String userSig) {
        this.userSig = userSig;
    }

    public Long getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Long businessId) {
        this.businessId = businessId;
    }

    public Long getVideoId() {
        return videoId;
    }

    public void setVideoId(Long videoId) {
        this.videoId = videoId;
    }

    public String getCustomroomid() {
        return customroomid;
    }

    public void setCustomroomid(String customroomid) {
        this.customroomid = customroomid;
    }

    public Long getSid() {
        return sid;
    }

    public void setSid(Long sid) {
        this.sid = sid;
    }
}
